package com.hbk.codemaker;

import javax.swing.JPanel;
import javax.swing.JTextField;

import com.hbk.programe.Constant;

public class ConstantPanel extends JPanel{
	
	public static final int HEIGHT=40;
	
	private JTextField typeField=new JTextField();
	
	private JTextField varField=new JTextField();
	
	private JTextField valueField=new JTextField();
	
	public ConstantPanel() {
		setLayout(null);
		typeField.setToolTipText("类型");
		varField.setToolTipText("声明");
		valueField.setToolTipText("值");
		typeField.setBounds(0, 0, 150, 32);
		varField.setBounds(0, 150+10, 150, 32);
		valueField.setBounds(0, 150+10+150+10, 150, 32);
	}
	
	public Constant getConstant() {
		Constant item=new Constant();
		item.setType(typeField.getText());
		item.setVar(varField.getText());
		item.setValue(valueField.getText());
		return item;
	}
	
	public void setConstant(Constant constant) {
		typeField.setText(constant.getType());
		varField.setText(constant.getVar());
		valueField.setText(constant.getValue());
	}

}
